﻿using System.Collections.Generic;

namespace BLL_Library
{
    public class IngredientSearch : SearchEngine
    {
        /// <summary>
        /// Konstruktorn - skickar indatan till baskonstruktor för initiering
        /// </summary>
        public IngredientSearch(List<Recipe> a_recipesList, string a_searchParameters)
            : base(a_recipesList, a_searchParameters)
        {
        } 
 
        /// <summary>
        /// Kollar om ingrediensen finns 
        /// </summary>
        public override bool IsSelected(Recipe a_recipe)
        {
            for (int i = 0; i < a_recipe.Ingredients.Count; i++)
            {
                if (a_recipe.Ingredients[i].Name.ToLower().StartsWith(m_searchParametersString))
                {
                    return true;
                }
            }
            return false;
        }
    }
}
